1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module adw.TabView; 26 27 private import adw.TabPage; 28 private import adw.c.functions; 29 public import adw.c.types; 30 private import gio.IconIF; 31 private import gio.MenuModel; 32 private import glib.ConstructionException; 33 private import gobject.ObjectG; 34 private import gobject.Signals; 35 private import gtk.AccessibleIF; 36 private import gtk.AccessibleT; 37 private import gtk.BuildableIF; 38 private import gtk.BuildableT; 39 private import gtk.ConstraintTargetIF; 40 private import gtk.ConstraintTargetT; 41 private import gtk.SelectionModelIF; 42 private import gtk.Widget; 43 private import std.algorithm; 44 45 46 /** 47 * A dynamic tabbed container. 48 * 49 * `AdwTabView` is a container which shows one child at a time. While it 50 * provides keyboard shortcuts for switching between pages, it does not provide 51 * a visible tab bar and relies on external widgets for that, such as 52 * [class@TabBar]. 53 * 54 * `AdwTabView` maintains a [class@TabPage] object for each page, which holds 55 * additional per-page properties. You can obtain the `AdwTabPage` for a page 56 * with [method@TabView.get_page], and as the return value for 57 * [method@TabView.append] and other functions for adding children. 58 * 59 * `AdwTabView` only aims to be useful for dynamic tabs in multi-window 60 * document-based applications, such as web browsers, file managers, text 61 * editors or terminals. It does not aim to replace [class@Gtk.Notebook] for use 62 * cases such as tabbed dialogs. 63 * 64 * As such, it does not support disabling page reordering or detaching. 65 * 66 * `AdwTabView` adds the following shortcuts in the managed scope: 67 * 68 * * <kbd>Ctrl</kbd>+<kbd>Page Up</kbd> - switch to the previous page 69 * * <kbd>Ctrl</kbd>+<kbd>Page Down</kbd> - switch to the next page 70 * * <kbd>Ctrl</kbd>+<kbd>Home</kbd> - switch to the first page 71 * * <kbd>Ctrl</kbd>+<kbd>End</kbd> - switch to the last page 72 * * <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>Page Up</kbd> - move the current page 73 * backward 74 * * <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>Page Down</kbd> - move the current 75 * page forward 76 * * <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>Home</kbd> - move the current page at 77 * the start 78 * * <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>End</kbd> - move the current page at 79 * the end 80 * * <kbd>Ctrl</kbd>+<kbd>Tab</kbd> - switch to the next page, with looping 81 * * <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>Tab</kbd> - switch to the previous 82 * page, with looping 83 * * <kbd>Alt</kbd>+<kbd>1</kbd>⋯<kbd>9</kbd> - switch to pages 1-9 84 * * <kbd>Alt</kbd>+<kbd>0</kbd> - switch to page 10 85 * 86 * ## CSS nodes 87 * 88 * `AdwTabView` has a main CSS node with the name `tabview`. 89 * 90 * Since: 1.0 91 */ 92 public class TabView : Widget 93 { 94 /** the main Gtk struct */ 95 protected AdwTabView* adwTabView; 96 97 /** Get the main Gtk struct */ 98 public AdwTabView* getTabViewStruct(bool transferOwnership = false) 99 { 100 if (transferOwnership) 101 ownedRef = false; 102 return adwTabView; 103 } 104 105 /** the main Gtk struct as a void* */ 106 protected override void* getStruct() 107 { 108 return cast(void*)adwTabView; 109 } 110 111 /** 112 * Sets our main struct and passes it to the parent class. 113 */ 114 public this (AdwTabView* adwTabView, bool ownedRef = false) 115 { 116 this.adwTabView = adwTabView; 117 super(cast(GtkWidget*)adwTabView, ownedRef); 118 } 119 120 121 /** */ 122 public static GType getType() 123 { 124 return adw_tab_view_get_type(); 125 } 126 127 /** 128 * Creates a new `AdwTabView`. 129 * 130 * Returns: the newly created `AdwTabView` 131 * 132 * Since: 1.0 133 * 134 * Throws: ConstructionException GTK+ fails to create the object. 135 */ 136 public this() 137 { 138 auto __p = adw_tab_view_new(); 139 140 if(__p is null) 141 { 142 throw new ConstructionException("null returned by new"); 143 } 144 145 this(cast(AdwTabView*) __p); 146 } 147 148 /** 149 * Adds @child to @self with @parent as the parent. 150 * 151 * This function can be used to automatically position new pages, and to select 152 * the correct page when this page is closed while being selected (see 153 * [method@TabView.close_page]). 154 * 155 * If @parent is `NULL`, this function is equivalent to [method@TabView.append]. 156 * 157 * Params: 158 * child = a widget to add 159 * parent = a parent page for @child 160 * 161 * Returns: the page object representing @child 162 * 163 * Since: 1.0 164 */ 165 public TabPage addPage(Widget child, TabPage parent) 166 { 167 auto __p = adw_tab_view_add_page(adwTabView, (child is null) ? null : child.getWidgetStruct(), (parent is null) ? null : parent.getTabPageStruct()); 168 169 if(__p is null) 170 { 171 return null; 172 } 173 174 return ObjectG.getDObject!(TabPage)(cast(AdwTabPage*) __p); 175 } 176 177 /** 178 * Inserts @child as the last non-pinned page. 179 * 180 * Params: 181 * child = a widget to add 182 * 183 * Returns: the page object representing @child 184 * 185 * Since: 1.0 186 */ 187 public TabPage append(Widget child) 188 { 189 auto __p = adw_tab_view_append(adwTabView, (child is null) ? null : child.getWidgetStruct()); 190 191 if(__p is null) 192 { 193 return null; 194 } 195 196 return ObjectG.getDObject!(TabPage)(cast(AdwTabPage*) __p); 197 } 198 199 /** 200 * Inserts @child as the last pinned page. 201 * 202 * Params: 203 * child = a widget to add 204 * 205 * Returns: the page object representing @child 206 * 207 * Since: 1.0 208 */ 209 public TabPage appendPinned(Widget child) 210 { 211 auto __p = adw_tab_view_append_pinned(adwTabView, (child is null) ? null : child.getWidgetStruct()); 212 213 if(__p is null) 214 { 215 return null; 216 } 217 218 return ObjectG.getDObject!(TabPage)(cast(AdwTabPage*) __p); 219 } 220 221 /** 222 * Requests to close all pages other than @page. 223 * 224 * Params: 225 * page = a page of @self 226 * 227 * Since: 1.0 228 */ 229 public void closeOtherPages(TabPage page) 230 { 231 adw_tab_view_close_other_pages(adwTabView, (page is null) ? null : page.getTabPageStruct()); 232 } 233 234 /** 235 * Requests to close @page. 236 * 237 * Calling this function will result in the [signal@TabView::close-page] signal 238 * being emitted for @page. Closing the page can then be confirmed or 239 * denied via [method@TabView.close_page_finish]. 240 * 241 * If the page is waiting for a [method@TabView.close_page_finish] call, this 242 * function will do nothing. 243 * 244 * The default handler for [signal@TabView::close-page] will immediately confirm 245 * closing the page if it's non-pinned, or reject it if it's pinned. This 246 * behavior can be changed by registering your own handler for that signal. 247 * 248 * If @page was selected, another page will be selected instead: 249 * 250 * If the [property@TabPage:parent] value is `NULL`, the next page will be 251 * selected when possible, or if the page was already last, the previous page 252 * will be selected instead. 253 * 254 * If it's not `NULL`, the previous page will be selected if it's a descendant 255 * (possibly indirect) of the parent. If both the previous page and the parent 256 * are pinned, the parent will be selected instead. 257 * 258 * Params: 259 * page = a page of @self 260 * 261 * Since: 1.0 262 */ 263 public void closePage(TabPage page) 264 { 265 adw_tab_view_close_page(adwTabView, (page is null) ? null : page.getTabPageStruct()); 266 } 267 268 /** 269 * Completes a [method@TabView.close_page] call for @page. 270 * 271 * If @confirm is `TRUE`, @page will be closed. If it's `FALSE`, it will be 272 * reverted to its previous state and [method@TabView.close_page] can be called 273 * for it again. 274 * 275 * This function should not be called unless a custom handler for 276 * [signal@TabView::close-page] is used. 277 * 278 * Params: 279 * page = a page of @self 280 * confirm = whether to confirm or deny closing @page 281 * 282 * Since: 1.0 283 */ 284 public void closePageFinish(TabPage page, bool confirm) 285 { 286 adw_tab_view_close_page_finish(adwTabView, (page is null) ? null : page.getTabPageStruct(), confirm); 287 } 288 289 /** 290 * Requests to close all pages after @page. 291 * 292 * Params: 293 * page = a page of @self 294 * 295 * Since: 1.0 296 */ 297 public void closePagesAfter(TabPage page) 298 { 299 adw_tab_view_close_pages_after(adwTabView, (page is null) ? null : page.getTabPageStruct()); 300 } 301 302 /** 303 * Requests to close all pages before @page. 304 * 305 * Params: 306 * page = a page of @self 307 * 308 * Since: 1.0 309 */ 310 public void closePagesBefore(TabPage page) 311 { 312 adw_tab_view_close_pages_before(adwTabView, (page is null) ? null : page.getTabPageStruct()); 313 } 314 315 /** 316 * Gets the default icon of @self. 317 * 318 * Returns: the default icon of @self. 319 * 320 * Since: 1.0 321 */ 322 public IconIF getDefaultIcon() 323 { 324 auto __p = adw_tab_view_get_default_icon(adwTabView); 325 326 if(__p is null) 327 { 328 return null; 329 } 330 331 return ObjectG.getDObject!(IconIF)(cast(GIcon*) __p); 332 } 333 334 /** 335 * Whether a page is being transferred. 336 * 337 * Returns: whether a page is being transferred 338 * 339 * Since: 1.0 340 */ 341 public bool getIsTransferringPage() 342 { 343 return adw_tab_view_get_is_transferring_page(adwTabView) != 0; 344 } 345 346 /** 347 * Gets the tab context menu model for @self. 348 * 349 * Returns: the tab context menu model for @self 350 * 351 * Since: 1.0 352 */ 353 public MenuModel getMenuModel() 354 { 355 auto __p = adw_tab_view_get_menu_model(adwTabView); 356 357 if(__p is null) 358 { 359 return null; 360 } 361 362 return ObjectG.getDObject!(MenuModel)(cast(GMenuModel*) __p); 363 } 364 365 /** 366 * Gets the number of pages in @self. 367 * 368 * Returns: the number of pages in @self 369 * 370 * Since: 1.0 371 */ 372 public int getNPages() 373 { 374 return adw_tab_view_get_n_pages(adwTabView); 375 } 376 377 /** 378 * Gets the number of pinned pages in @self. 379 * 380 * Returns: the number of pinned pages in @self 381 * 382 * Since: 1.0 383 */ 384 public int getNPinnedPages() 385 { 386 return adw_tab_view_get_n_pinned_pages(adwTabView); 387 } 388 389 /** 390 * Gets the [class@TabPage] representing the child at @position. 391 * 392 * Params: 393 * position = the index of the page in @self, starting from 0 394 * 395 * Returns: the page object at @position 396 * 397 * Since: 1.0 398 */ 399 public TabPage getNthPage(int position) 400 { 401 auto __p = adw_tab_view_get_nth_page(adwTabView, position); 402 403 if(__p is null) 404 { 405 return null; 406 } 407 408 return ObjectG.getDObject!(TabPage)(cast(AdwTabPage*) __p); 409 } 410 411 /** 412 * Gets the [class@TabPage] object representing @child. 413 * 414 * Params: 415 * child = a child in @self 416 * 417 * Returns: the page object for @child 418 * 419 * Since: 1.0 420 */ 421 public TabPage getPage(Widget child) 422 { 423 auto __p = adw_tab_view_get_page(adwTabView, (child is null) ? null : child.getWidgetStruct()); 424 425 if(__p is null) 426 { 427 return null; 428 } 429 430 return ObjectG.getDObject!(TabPage)(cast(AdwTabPage*) __p); 431 } 432 433 /** 434 * Finds the position of @page in @self, starting from 0. 435 * 436 * Params: 437 * page = a page of @self 438 * 439 * Returns: the position of @page in @self 440 * 441 * Since: 1.0 442 */ 443 public int getPagePosition(TabPage page) 444 { 445 return adw_tab_view_get_page_position(adwTabView, (page is null) ? null : page.getTabPageStruct()); 446 } 447 448 /** 449 * Returns a [iface@Gio.ListModel] that contains the pages of @self. 450 * 451 * This can be used to keep an up-to-date view. The model also implements 452 * [iface@Gtk.SelectionModel] and can be used to track and change the selected 453 * page. 454 * 455 * Returns: a `GtkSelectionModel` for the pages of @self 456 * 457 * Since: 1.0 458 */ 459 public SelectionModelIF getPages() 460 { 461 auto __p = adw_tab_view_get_pages(adwTabView); 462 463 if(__p is null) 464 { 465 return null; 466 } 467 468 return ObjectG.getDObject!(SelectionModelIF)(cast(GtkSelectionModel*) __p, true); 469 } 470 471 /** 472 * Gets the currently selected page in @self. 473 * 474 * Returns: the selected page 475 * 476 * Since: 1.0 477 */ 478 public TabPage getSelectedPage() 479 { 480 auto __p = adw_tab_view_get_selected_page(adwTabView); 481 482 if(__p is null) 483 { 484 return null; 485 } 486 487 return ObjectG.getDObject!(TabPage)(cast(AdwTabPage*) __p); 488 } 489 490 /** 491 * Inserts a non-pinned page at @position. 492 * 493 * It's an error to try to insert a page before a pinned page, in that case 494 * [method@TabView.insert_pinned] should be used instead. 495 * 496 * Params: 497 * child = a widget to add 498 * position = the position to add @child at, starting from 0 499 * 500 * Returns: the page object representing @child 501 * 502 * Since: 1.0 503 */ 504 public TabPage insert(Widget child, int position) 505 { 506 auto __p = adw_tab_view_insert(adwTabView, (child is null) ? null : child.getWidgetStruct(), position); 507 508 if(__p is null) 509 { 510 return null; 511 } 512 513 return ObjectG.getDObject!(TabPage)(cast(AdwTabPage*) __p); 514 } 515 516 /** 517 * Inserts a pinned page at @position. 518 * 519 * It's an error to try to insert a pinned page after a non-pinned page, in 520 * that case [method@TabView.insert] should be used instead. 521 * 522 * Params: 523 * child = a widget to add 524 * position = the position to add @child at, starting from 0 525 * 526 * Returns: the page object representing @child 527 * 528 * Since: 1.0 529 */ 530 public TabPage insertPinned(Widget child, int position) 531 { 532 auto __p = adw_tab_view_insert_pinned(adwTabView, (child is null) ? null : child.getWidgetStruct(), position); 533 534 if(__p is null) 535 { 536 return null; 537 } 538 539 return ObjectG.getDObject!(TabPage)(cast(AdwTabPage*) __p); 540 } 541 542 /** 543 * Inserts @child as the first non-pinned page. 544 * 545 * Params: 546 * child = a widget to add 547 * 548 * Returns: the page object representing @child 549 * 550 * Since: 1.0 551 */ 552 public TabPage prepend(Widget child) 553 { 554 auto __p = adw_tab_view_prepend(adwTabView, (child is null) ? null : child.getWidgetStruct()); 555 556 if(__p is null) 557 { 558 return null; 559 } 560 561 return ObjectG.getDObject!(TabPage)(cast(AdwTabPage*) __p); 562 } 563 564 /** 565 * Inserts @child as the first pinned page. 566 * 567 * Params: 568 * child = a widget to add 569 * 570 * Returns: the page object representing @child 571 * 572 * Since: 1.0 573 */ 574 public TabPage prependPinned(Widget child) 575 { 576 auto __p = adw_tab_view_prepend_pinned(adwTabView, (child is null) ? null : child.getWidgetStruct()); 577 578 if(__p is null) 579 { 580 return null; 581 } 582 583 return ObjectG.getDObject!(TabPage)(cast(AdwTabPage*) __p); 584 } 585 586 /** 587 * Reorders @page to before its previous page if possible. 588 * 589 * Params: 590 * page = a page of @self 591 * 592 * Returns: whether @page was moved 593 * 594 * Since: 1.0 595 */ 596 public bool reorderBackward(TabPage page) 597 { 598 return adw_tab_view_reorder_backward(adwTabView, (page is null) ? null : page.getTabPageStruct()) != 0; 599 } 600 601 /** 602 * Reorders @page to the first possible position. 603 * 604 * Params: 605 * page = a page of @self 606 * 607 * Returns: whether @page was moved 608 * 609 * Since: 1.0 610 */ 611 public bool reorderFirst(TabPage page) 612 { 613 return adw_tab_view_reorder_first(adwTabView, (page is null) ? null : page.getTabPageStruct()) != 0; 614 } 615 616 /** 617 * Reorders @page to after its next page if possible. 618 * 619 * Params: 620 * page = a page of @self 621 * 622 * Returns: whether @page was moved 623 * 624 * Since: 1.0 625 */ 626 public bool reorderForward(TabPage page) 627 { 628 return adw_tab_view_reorder_forward(adwTabView, (page is null) ? null : page.getTabPageStruct()) != 0; 629 } 630 631 /** 632 * Reorders @page to the last possible position. 633 * 634 * Params: 635 * page = a page of @self 636 * 637 * Returns: whether @page was moved 638 * 639 * Since: 1.0 640 */ 641 public bool reorderLast(TabPage page) 642 { 643 return adw_tab_view_reorder_last(adwTabView, (page is null) ? null : page.getTabPageStruct()) != 0; 644 } 645 646 /** 647 * Reorders @page to @position. 648 * 649 * It's a programmer error to try to reorder a pinned page after a non-pinned 650 * one, or a non-pinned page before a pinned one. 651 * 652 * Params: 653 * page = a page of @self 654 * position = the position to insert the page at, starting at 0 655 * 656 * Returns: whether @page was moved 657 * 658 * Since: 1.0 659 */ 660 public bool reorderPage(TabPage page, int position) 661 { 662 return adw_tab_view_reorder_page(adwTabView, (page is null) ? null : page.getTabPageStruct(), position) != 0; 663 } 664 665 /** 666 * Selects the page after the currently selected page. 667 * 668 * If the last page was already selected, this function does nothing. 669 * 670 * Returns: whether the selected page was changed 671 * 672 * Since: 1.0 673 */ 674 public bool selectNextPage() 675 { 676 return adw_tab_view_select_next_page(adwTabView) != 0; 677 } 678 679 /** 680 * Selects the page before the currently selected page. 681 * 682 * If the first page was already selected, this function does nothing. 683 * 684 * Returns: whether the selected page was changed 685 * 686 * Since: 1.0 687 */ 688 public bool selectPreviousPage() 689 { 690 return adw_tab_view_select_previous_page(adwTabView) != 0; 691 } 692 693 /** 694 * Sets the default page icon for @self. 695 * 696 * Params: 697 * defaultIcon = the default icon 698 * 699 * Since: 1.0 700 */ 701 public void setDefaultIcon(IconIF defaultIcon) 702 { 703 adw_tab_view_set_default_icon(adwTabView, (defaultIcon is null) ? null : defaultIcon.getIconStruct()); 704 } 705 706 /** 707 * Sets the tab context menu model for @self. 708 * 709 * Params: 710 * menuModel = a menu model 711 * 712 * Since: 1.0 713 */ 714 public void setMenuModel(MenuModel menuModel) 715 { 716 adw_tab_view_set_menu_model(adwTabView, (menuModel is null) ? null : menuModel.getMenuModelStruct()); 717 } 718 719 /** 720 * Pins or unpins @page. 721 * 722 * Pinned pages are guaranteed to be placed before all non-pinned pages; at any 723 * given moment the first [property@TabView:n-pinned-pages] pages in @self are 724 * guaranteed to be pinned. 725 * 726 * When a page is pinned or unpinned, it's automatically reordered: pinning a 727 * page moves it after other pinned pages; unpinning a page moves it before 728 * other non-pinned pages. 729 * 730 * Pinned pages can still be reordered between each other. 731 * 732 * [class@TabBar] will display pinned pages in a compact form, never showing the 733 * title or close button, and only showing a single icon, selected in the 734 * following order: 735 * 736 * 1. [property@TabPage:indicator-icon] 737 * 2. A spinner if [property@TabPage:loading] is `TRUE` 738 * 3. [property@TabPage:icon] 739 * 4. [property@TabView:default-icon] 740 * 741 * Pinned pages cannot be closed by default, see [signal@TabView::close-page] 742 * for how to override that behavior. 743 * 744 * Changes the value of the [property@TabPage:pinned] property. 745 * 746 * Params: 747 * page = a page of @self 748 * pinned = whether @page should be pinned 749 * 750 * Since: 1.0 751 */ 752 public void setPagePinned(TabPage page, bool pinned) 753 { 754 adw_tab_view_set_page_pinned(adwTabView, (page is null) ? null : page.getTabPageStruct(), pinned); 755 } 756 757 /** 758 * Sets the currently selected page in @self. 759 * 760 * Params: 761 * selectedPage = a page in @self 762 * 763 * Since: 1.0 764 */ 765 public void setSelectedPage(TabPage selectedPage) 766 { 767 adw_tab_view_set_selected_page(adwTabView, (selectedPage is null) ? null : selectedPage.getTabPageStruct()); 768 } 769 770 /** 771 * Transfers @page from @self to @other_view. 772 * 773 * The @page object will be reused. 774 * 775 * It's a programmer error to try to insert a pinned page after a non-pinned 776 * one, or a non-pinned page before a pinned one. 777 * 778 * Params: 779 * page = a page of @self 780 * otherView = the tab view to transfer the page to 781 * position = the position to insert the page at, starting at 0 782 * 783 * Since: 1.0 784 */ 785 public void transferPage(TabPage page, TabView otherView, int position) 786 { 787 adw_tab_view_transfer_page(adwTabView, (page is null) ? null : page.getTabPageStruct(), (otherView is null) ? null : otherView.getTabViewStruct(), position); 788 } 789 790 /** 791 * Emitted after [method@TabView.close_page] has been called for @page. 792 * 793 * The handler is expected to call [method@TabView.close_page_finish] to 794 * confirm or reject the closing. 795 * 796 * The default handler will immediately confirm closing for non-pinned pages, 797 * or reject it for pinned pages, equivalent to the following example: 798 * 799 * ```c 800 * static gboolean 801 * close_page_cb (AdwTabView *view, 802 * AdwTabPage *page, 803 * gpointer user_data) 804 * { 805 * adw_tab_view_close_page_finish (view, page, !adw_tab_page_get_pinned (page)); 806 * 807 * return GDK_EVENT_STOP; 808 * } 809 * ``` 810 * 811 * The [method@TabView.close_page_finish] call doesn't have to happen inside 812 * the handler, so can be used to do asynchronous checks before confirming the 813 * closing. 814 * 815 * A typical reason to connect to this signal is to show a confirmation dialog 816 * for closing a tab. 817 * 818 * Params: 819 * page = a page of @self 820 * 821 * Since: 1.0 822 */ 823 gulong addOnClosePage(bool delegate(TabPage, TabView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 824 { 825 return Signals.connect(this, "close-page", dlg, connectFlags ^ ConnectFlags.SWAPPED); 826 } 827 828 /** 829 * Emitted when a tab should be transferred into a new window. 830 * 831 * This can happen after a tab has been dropped on desktop. 832 * 833 * The signal handler is expected to create a new window, position it as 834 * needed and return its `AdwTabView` that the page will be transferred into. 835 * 836 * Returns: the `AdwTabView` from the new window 837 * 838 * Since: 1.0 839 */ 840 gulong addOnCreateWindow(TabView delegate(TabView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 841 { 842 return Signals.connect(this, "create-window", dlg, connectFlags ^ ConnectFlags.SWAPPED); 843 } 844 845 /** 846 * Emitted after the indicator icon on @page has been activated. 847 * 848 * See [property@TabPage:indicator-icon] and 849 * [property@TabPage:indicator-activatable]. 850 * 851 * Params: 852 * page = a page of @self 853 * 854 * Since: 1.0 855 */ 856 gulong addOnIndicatorActivated(void delegate(TabPage, TabView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 857 { 858 return Signals.connect(this, "indicator-activated", dlg, connectFlags ^ ConnectFlags.SWAPPED); 859 } 860 861 /** 862 * Emitted when a page has been created or transferred to @self. 863 * 864 * A typical reason to connect to this signal would be to connect to page 865 * signals for things such as updating window title. 866 * 867 * Params: 868 * page = a page of @self 869 * position = the position of the page, starting from 0 870 * 871 * Since: 1.0 872 */ 873 gulong addOnPageAttached(void delegate(TabPage, int, TabView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 874 { 875 return Signals.connect(this, "page-attached", dlg, connectFlags ^ ConnectFlags.SWAPPED); 876 } 877 878 /** 879 * Emitted when a page has been removed or transferred to another view. 880 * 881 * A typical reason to connect to this signal would be to disconnect signal 882 * handlers connected in the [signal@TabView::page-attached] handler. 883 * 884 * It is important not to try and destroy the page child in the handler of 885 * this function as the child might merely be moved to another window; use 886 * child dispose handler for that or do it in sync with your 887 * [method@TabView.close_page_finish] calls. 888 * 889 * Params: 890 * page = a page of @self 891 * position = the position of the removed page, starting from 0 892 * 893 * Since: 1.0 894 */ 895 gulong addOnPageDetached(void delegate(TabPage, int, TabView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 896 { 897 return Signals.connect(this, "page-detached", dlg, connectFlags ^ ConnectFlags.SWAPPED); 898 } 899 900 /** 901 * Emitted after @page has been reordered to @position. 902 * 903 * Params: 904 * page = a page of @self 905 * position = the position @page was moved to, starting at 0 906 * 907 * Since: 1.0 908 */ 909 gulong addOnPageReordered(void delegate(TabPage, int, TabView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 910 { 911 return Signals.connect(this, "page-reordered", dlg, connectFlags ^ ConnectFlags.SWAPPED); 912 } 913 914 /** 915 * Emitted when a context menu is opened or closed for @page. 916 * 917 * If the menu has been closed, @page will be set to `NULL`. 918 * 919 * It can be used to set up menu actions before showing the menu, for example 920 * disable actions not applicable to @page. 921 * 922 * Params: 923 * page = a page of @self 924 * 925 * Since: 1.0 926 */ 927 gulong addOnSetupMenu(void delegate(TabPage, TabView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 928 { 929 return Signals.connect(this, "setup-menu", dlg, connectFlags ^ ConnectFlags.SWAPPED); 930 } 931 }